
from pytrends.request import TrendReq
import matplotlib.pyplot as plt
import time
import pandas as pd
import datetime as dt


term = ["protest"]
area = 'US-MD-512'

pred = TrendReq(hl='en-US', tz=360)

data = pred.get_historical_interest(term, year_start=2015, month_start=4, day_start=13, hour_start=0,
                                    year_end=2015, month_end=4, day_end=21, hour_end=0, cat=0, geo=area, gprop='', sleep=0)
data1 = pred.get_historical_interest(term, year_start=2015, month_start=4, day_start=18, hour_start=0,
                                    year_end=2015, month_end=4, day_end=24, hour_end=0, cat=0, geo=area, gprop='', sleep=0)
data2 = pred.get_historical_interest(term, year_start=2015, month_start=4, day_start=21, hour_start=0,
                                    year_end=2015, month_end=4, day_end=28, hour_end=0, cat=0, geo=area, gprop='', sleep=0)


data.to_csv('../Figure_1_2/fig1a.csv', index = ['date'], header=True)
data1.to_csv('../Figure_1_2/fig1b.csv', index = ['date'], header=True)
data2.to_csv('../Figure_1_2/fig1c.csv', index = ['date'], header=True)

